package com.web.service.impl;

import com.web.dao.StudentDAO;
import com.web.dao.impl.StudentDAOImpl;
import com.web.entity.PageVO;
import com.web.service.StudentService;
import com.web.test.Student;

import java.util.List;

/**
 * @author lenovo
 * @Description
 * @Date2025-2-28 16:56
 */
public class StudentServiceImpl implements StudentService {
    private StudentDAO studentDAO = new StudentDAOImpl();
    @Override
    public List<Student> findAllStudents(){
        return studentDAO.selectAllStudents();

    }
    @Override
    public PageVO findStudentPage(int current,int pageSize){
        //查询学生总数
        int count=studentDAO.selectStudentCount();
        //获得查询的行数
        int start=(current-1)*pageSize;
        //分页查询学生集合
        List<Student> students=studentDAO.selectStudentPage(start,pageSize);
        return new PageVO(current,pageSize,count,students);
    }
}
